Tool cleanups.
*.a
+*.d
*.o
*.pyc
*.so
linux-xen-sparse
patches/*
tools/*/build/lib*/*.py
-tools/balloon/balloon
tools/misc/miniterm/miniterm
tools/misc/xen_cpuperf
-tools/misc/xen_log
-tools/misc/xen_read_console
-tools/xc/lib/.allocate.o.d
-tools/xc/lib/.file_stream.o.d
-tools/xc/lib/.gzip_stream.o.d
-tools/xc/lib/.iostream.o.d
-tools/xc/lib/.sys_net.o.d
-tools/xc/lib/.sys_string.o.d
-tools/xc/lib/.xc_atropos.o.d
-tools/xc/lib/.xc_bvtsched.o.d
-tools/xc/lib/.xc_domain.o.d
-tools/xc/lib/.xc_evtchn.o.d
-tools/xc/lib/.xc_io.o.d
-tools/xc/lib/.xc_linux_build.o.d
-tools/xc/lib/.xc_linux_restore.o.d
-tools/xc/lib/.xc_linux_save.o.d
-tools/xc/lib/.xc_misc.o.d
-tools/xc/lib/.xc_netbsd_build.o.d
-tools/xc/lib/.xc_physdev.o.d
-tools/xc/lib/.xc_private.o.d
tools/xentrace/xentrace
xen/drivers/pci/classlist.h
xen/drivers/pci/devlist.h
xen/xen
xen/xen-syms
xen/xen.*
-tools/xc/lib/.xc_rrobin.o.d
-tools/libxc/.xc_atropos.o.d
-tools/libxc/.xc_bvtsched.o.d
-tools/libxc/.xc_domain.o.d
-tools/libxc/.xc_evtchn.o.d
-tools/libxc/.xc_io.o.d
-tools/libxc/.xc_linux_build.o.d
-tools/libxc/.xc_linux_restore.o.d
-tools/libxc/.xc_linux_save.o.d
-tools/libxc/.xc_misc.o.d
-tools/libxc/.xc_netbsd_build.o.d
-tools/libxc/.xc_physdev.o.d
-tools/libxc/.xc_private.o.d
-tools/libxc/.xc_rrobin.o.d
-tools/libxutil/.allocate.o.d
-tools/libxutil/.file_stream.o.d
-tools/libxutil/.gzip_stream.o.d
-tools/libxutil/.iostream.o.d
-tools/libxutil/.sys_net.o.d
-tools/libxutil/.sys_string.o.d
vpath %c $(XEN_LIBXUTIL)
INCLUDES += -I $(XEN_LIBXUTIL)
-LIB_SRCS :=
-LIB_SRCS += allocate.c
-#LIB_SRCS += enum.c
-LIB_SRCS += file_stream.c
-LIB_SRCS += gzip_stream.c
-#LIB_SRCS += hash_table.c
-LIB_SRCS += iostream.c
-#LIB_SRCS += kernel_stream.c
-#LIB_SRCS += lexis.c
-#LIB_SRCS += lzi_stream.c
-#LIB_SRCS += lzo_stream.c
-#LIB_SRCS += marshal.c
-#LIB_SRCS += socket_stream.c
-#LIB_SRCS += string_stream.c
-#LIB_SRCS += sxpr.c
-#LIB_SRCS += sxpr_parser.c
-LIB_SRCS += sys_net.c
-LIB_SRCS += sys_string.c
-#LIB_SRCS += xdr.c
-
SRCS :=
SRCS += xc_atropos.c
SRCS += xc_bvtsched.c
SRCS += xc_private.c
SRCS += xc_rrobin.c
-#SRCS += $(LIB_SRCS)
-
CFLAGS += -Wall
CFLAGS += -Werror
-CFLAGS += -g
CFLAGS += -O3
CFLAGS += -fno-strict-aliasing
CFLAGS += $(INCLUDES)
libxc.so.$(MAJOR):
ln -sf libxc.so.$(MAJOR).$(MINOR) $@
libxc.so.$(MAJOR).$(MINOR): $(OBJS)
- $(CC) -Wl,-soname -Wl,$(SONAME) -shared -o $@ $^ ../libxutil/libxutil.a -lz
-
-%.o: %.c Makefile
-
-# $(CC) $(CFLAGS) -o $@ $<
+ $(CC) -Wl,-soname -Wl,$(SONAME) -shared -o $@ $^ -L../libxutil -lxutil -lz
-include $(DEPS)
LIB_SRCS :=
LIB_SRCS += allocate.c
-#LIB_SRCS += enum.c
LIB_SRCS += file_stream.c
LIB_SRCS += gzip_stream.c
-#LIB_SRCS += hash_table.c
LIB_SRCS += iostream.c
-#LIB_SRCS += kernel_stream.c
-#LIB_SRCS += lexis.c
-#LIB_SRCS += lzi_stream.c
-#LIB_SRCS += lzo_stream.c
-#LIB_SRCS += marshal.c
-#LIB_SRCS += socket_stream.c
-#LIB_SRCS += string_stream.c
-#LIB_SRCS += sxpr.c
-#LIB_SRCS += sxpr_parser.c
LIB_SRCS += sys_net.c
LIB_SRCS += sys_string.c
-#LIB_SRCS += xdr.c
LIB_OBJS := $(LIB_SRCS:.c=.o)
CFLAGS += -g
CFLAGS += -O3
CFLAGS += -fno-strict-aliasing
-#CFLAGS += $(INCLUDES)
+
# Get gcc to generate the dependencies for us.
CFLAGS += -Wp,-MD,.$(@F).d
DEPS = .*.d
-MAJOR = 1.3
-MINOR = 0
-LIB_NAME = libxutil
-LIB_BASE = $(LIB_NAME).so
-LIB_MAJOR= $(LIB_BASE).$(MAJOR)
-LIB_MINOR= $(LIB_MAJOR).$(MINOR)
-LIB = $(LIB_BASE) $(LIB_MAJOR) $(LIB_MINOR) $(LIB_NAME).a
+MAJOR := 1.3
+MINOR := 0
+LIB_NAME := libxutil
+LIB := $(LIB_NAME).so
+LIB += $(LIB_NAME).so.$(MAJOR)
+LIB += $(LIB_NAME).so.$(MAJOR).$(MINOR)
all: check-for-zlib $(LIB)
-$(LIB_BASE):
- ln -sf $(LIB_MAJOR) $@
-
-$(LIB_MAJOR):
- ln -sf $(LIB_MINOR) $@
+$(LIB_NAME).so:
+ ln -sf $(LIB_NAME).so.$(MAJOR) $@
-$(LIB_MINOR): $(LIB_OBJS)
- $(CC) -Wl,-soname -Wl,$(LIB_MAJOR) -shared -o $@ $^
+$(LIB_NAME).so.$(MAJOR):
+ ln -sf $(LIB_NAME).so.$(MAJOR).$(MINOR) $@
-$(LIB_NAME).a: $(LIB_OBJS)
- $(AR) rc $@ $^
+$(LIB_NAME).so.$(MAJOR).$(MINOR): $(LIB_OBJS)
+ $(CC) -Wl,-soname -Wl,$(LIB_NAME).so.$(MAJOR) -shared -o $@ $^
check-for-zlib:
@if [ ! -e /usr/include/zlib.h ]; then \
mkdir -p $(prefix)/usr/lib
mkdir -p $(prefix)/usr/include
install -m0755 $(LIB) $(prefix)/usr/lib
-
-#install -m0644 xc.h $(prefix)/usr/include
+ install -m0644 xc.h $(prefix)/usr/include
clean:
$(RM) *.a *.so *.o *.rpm $(LIB)
XEN_ROOT = "../.."
-extra_compile_args = ["-fno-strict-aliasing"]
+extra_compile_args = [ "-fno-strict-aliasing", "-Wall", "-Werror" ]
include_dirs = [ XEN_ROOT + "/xen/include/hypervisor-ifs",
return list;
}
-static int file_save(XcObject *xc, XcIOContext *ctxt, char *state_file){
+static int file_save(XcObject *xc, XcIOContext *ctxt, char *state_file)
+{
int rc = -1;
int fd = -1;
int open_flags = (O_CREAT | O_EXCL | O_WRONLY);
int open_mode = 0644;
printf("%s>\n", __FUNCTION__);
- fd = open(state_file, open_flags, open_mode);
- if(fd < 0){
+
+ if ( (fd = open(state_file, open_flags, open_mode)) < 0 )
+ {
xcio_perror(ctxt, "Could not open file for writing");
goto exit;
}
+
+ printf("%s>gzip_stream_fdopen... \n", __FUNCTION__);
+
/* Compression rate 1: we want speed over compression.
* We're mainly going for those zero pages, after all.
*/
- printf("%s>gzip_stream_fdopen... \n", __FUNCTION__);
ctxt->io = gzip_stream_fdopen(fd, "wb1");
- if(!ctxt->io){
+ if ( ctxt->io == NULL )
+ {
xcio_perror(ctxt, "Could not allocate compression state");
goto exit;
}
+
printf("%s> xc_linux_save...\n", __FUNCTION__);
+
rc = xc_linux_save(xc->xc_handle, ctxt);
+
exit:
- if(ctxt->io) IOStream_close(ctxt->io);
- if(fd >= 0) close(fd);
+ if ( ctxt->io != NULL )
+ IOStream_close(ctxt->io);
+ if ( fd >= 0 )
+ close(fd);
unlink(state_file);
printf("%s> rc=%d\n", __FUNCTION__, rc);
return rc;
{
XcObject *xc = (XcObject *)self;
- u32 dom;
char *state_file;
int progress = 1, debug = 0;
- unsigned int flags = 0;
PyObject *val = NULL;
int rc = -1;
XcIOContext ioctxt = { .info = iostdout, .err = iostderr };
static char *kwd_list[] = { "dom", "state_file", "vmconfig", "progress", "debug", NULL };
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "is|sii", kwd_list,
- &ioctxt.domain,
- &state_file,
- &ioctxt.vmconfig,
- &progress,
- &debug)){
+ if ( !PyArg_ParseTupleAndKeywords(args, kwds, "is|sii", kwd_list,
+ &ioctxt.domain,
+ &state_file,
+ &ioctxt.vmconfig,
+ &progress,
+ &debug) )
goto exit;
- }
+
ioctxt.vmconfig_n = (ioctxt.vmconfig ? strlen(ioctxt.vmconfig) : 0);
- if (progress) ioctxt.flags |= XCFLAGS_VERBOSE;
- if (debug) ioctxt.flags |= XCFLAGS_DEBUG;
- if(!state_file || state_file[0] == '\0') goto exit;
+
+ if ( progress )
+ ioctxt.flags |= XCFLAGS_VERBOSE;
+ if ( debug )
+ ioctxt.flags |= XCFLAGS_DEBUG;
+
+ if ( (state_file == NULL) || (state_file[0] == '\0') )
+ goto exit;
+
rc = file_save(xc, &ioctxt, state_file);
- if(rc){
+ if ( rc != 0 )
+ {
PyErr_SetFromErrno(xc_error);
goto exit;
}
- //xc_domain_destroy(xc->xc_handle, dom);
+
Py_INCREF(zero);
val = zero;
+
exit:
return val;
}
-static int file_restore(XcObject *xc, XcIOContext *ioctxt, char *state_file){
+static int file_restore(XcObject *xc, XcIOContext *ioctxt, char *state_file)
+{
int rc = -1;
ioctxt->io = gzip_stream_fopen(state_file, "rb");
- if (!ioctxt->io) {
+ if ( ioctxt->io == NULL )
+ {
xcio_perror(ioctxt, "Could not open file for reading");
- goto exit;
+ return rc;
}
rc = xc_linux_restore(xc->xc_handle, ioctxt);
- exit:
- if(ioctxt->io) IOStream_close(ioctxt->io);
+
+ IOStream_close(ioctxt->io);
+
return rc;
}
XcObject *xc = (XcObject *)self;
char *state_file;
int progress = 1, debug = 0;
- u32 dom;
PyObject *val = NULL;
XcIOContext ioctxt = { .info = iostdout, .err = iostderr };
int rc =-1;
static char *kwd_list[] = { "state_file", "progress", "debug", NULL };
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "is|ii", kwd_list,
- &ioctxt.domain,
- &state_file,
- &progress,
- &debug)){
+ if ( !PyArg_ParseTupleAndKeywords(args, kwds, "is|ii", kwd_list,
+ &ioctxt.domain,
+ &state_file,
+ &progress,
+ &debug) )
+ goto exit;
+
+ if ( progress )
+ ioctxt.flags |= XCFLAGS_VERBOSE;
+ if ( debug )
+ ioctxt.flags |= XCFLAGS_DEBUG;
+
+ if ( (state_file == NULL) || (state_file[0] == '\0') )
goto exit;
- }
- if (progress) ioctxt.flags |= XCFLAGS_VERBOSE;
- if (debug) ioctxt.flags |= XCFLAGS_DEBUG;
- if(!state_file || state_file[0] == '\0') goto exit;
rc = file_restore(xc, &ioctxt, state_file);
- if(rc){
+ if ( rc != 0 )
+ {
PyErr_SetFromErrno(xc_error);
goto exit;
}
+
val = Py_BuildValue("{s:i,s:s}",
"dom", ioctxt.domain,
"vmconfig", ioctxt.vmconfig);
- //? free(ioctxt.vmconfig);
+
exit:
return val;
}
include $(XEN_ROOT)/tools/Make.defs
CC = gcc
-CFLAGS = -Wall -O3 -Werror
+CFLAGS = -Wall -Werror -O3
CFLAGS += -I $(XEN_HYPERVISOR_IFS)
CFLAGS += -I $(XEN_LINUX_INCLUDE)
$(RM) *.a *.so *.o *.rpm $(BIN)
%: %.c $(HDRS) Makefile
- $(CC) $(CFLAGS) -o $@ $< -L$(XEN_LIBXC) -lxc
+ $(CC) $(CFLAGS) -o $@ $< -L$(XEN_LIBXC) -L$(XEN_LIBXUTIL) -lxc -lxutil